<?php
namespace common\components;

class DetailView extends \yii\widgets\DetailView {

    public function init(){
        foreach ($this->attributes as $index => $attribute){
            if(is_string($attribute)){
                if(in_array($attribute, ['_intm', '_uptm'])){
                    $this->attributes[$index] = ['attribute' => $attribute, 'format' => ['datetime', 'yyyy-MM-dd HH:mm:ss']];
                }elseif(strpos($attribute, ':datetime')){
                    $attribute = explode(':', $attribute);
                    $this->attributes[$index] = ['attribute' => $attribute[0], 'format' => ['datetime', 'yyyy-MM-dd HH:mm:ss']];
                }
            }else if(is_array($attribute) && isset($attribute['format']) && $attribute['format'] == 'datetime'){
                $attribute['format'] = ['datetime', 'yyyy-MM-dd HH:mm:ss'];
                $this->attributes[$index] = $attribute;
            }
        }
        parent::init();
      }
}

?>
